
<template>
  <div>
    <select-hospital @selectedHospital="selectedHospital" />
    <van-field v-model="distance" center clearable label="距离:" placeholder="请输入距离" >
      <van-button slot="button" size="small" type="danger" @click="add">添加</van-button>
    </van-field>      
    <van-cell-group title="已选择的附近医院" style="height:200px">
      <van-cell title="i.name" value="内容" v-for="(i,index) in items" :key="index">
        <van-button slot="button" size="small" type="danger" @click="del(i.id)">删除</van-button>
      </van-cell>
    </van-cell-group>
    <van-button slot="button" size="small" type="danger" @click="save">保存</van-button>
    
  </div>
</template>

<script>
  import { get } from "@/api/common";
  import SelectHospital from "../components/SelectHospital";
  import { Toast,Dialog } from 'vant';

  export default {
    props: ['hotel'],
    components: {
      SelectHospital
    },
    data() {
      return {
        items: [],
        hospital: {},
        distance: 0,
      }
    },
    mounted() {
      
    },
    methods: {
      selectedHospital(value) {
        this.hospital = value;
        //查询医院信息,和每个酒店的距离

      },
      add() {
        this.items.push({name:this.hospital.name,id:this.hospital.id,distance:this.distance});
        console.info(this.items);
      },
      save() {
        Toast('还没实现...')
      },
      del(item) {
        Toast('还没实现...')
      },
    }
  }
</script>

<style scoped>
p{
  padding-left:10px;
}
</style>
  